/*关于系统的影响：
 1，在使用windows 7系统时，将代码中的windows_7取消注释，而将windows_10注释掉
 2，其中在下面的switch语句的条件判断语句中，使用windows_7时，按照下面将“32”改为“0”
 3，为了更好的游戏体验，在使用windows_10时请注意改变命令行字体，有以下几种推荐：
       （1）选择“点阵字体”，大小选12*16，这个墙是圆的，但体验比较好；
	   （2）选择“点阵字体”，大小选8*12，这个挺正常，但有点小；
	   （3）选择“点阵字体”，大小选8*16，这个最像windows_7的风格； 
*/
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string> 
#include<iostream>
#include<windows.h>
using namespace std;

int main(){
		
	string name;//your name
	char ip;//the Char of input
	int x=0,y=2;//original position of you
	
	/*------------------------this is dividing line-------------------------*/
	
	/*char a[15][26]={
	32,2,21,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
	32,2,32,2,32,2,32,32,32,2,32,32,32,2,32,32,2,32,32,2,32,2,2,32,2,2,
	32,2,32,32,32,2,32,2,2,2,32,2,2,2,2,32,2,5,32,32,32,32,2,32,32,2,
	32,2,32,2,32,2,32,2,32,32,32,2,32,32,2,32,2,2,2,32,2,32,2,2,32,2,
	32,2,32,2,32,2,32,32,32,2,32,32,32,32,2,32,2,32,2,2,2,32,32,32,32,2,
	32,2,32,2,32,32,32,2,32,2,32,32,2,32,32,32,2,32,2,32,2,2,2,32,2,2,
	32,2,32,32,32,32,32,2,32,2,2,2,2,2,32,32,32,32,2,32,2,32,2,32,2,2,
	32,2,2,32,2,32,32,2,32,2,32,2,32,32,32,32,2,32,2,32,32,32,2,32,2,2,
	32,2,2,32,2,2,32,2,32,32,32,2,2,32,2,2,2,32,32,32,32,32,32,32,2,2,
	32,2,32,32,2,2,32,2,2,2,32,32,32,32,2,32,32,32,2,2,2,32,32,32,32,2,
	32,2,32,2,2,32,32,32,32,2,32,2,32,32,2,32,2,2,2,32,2,32,2,32,32,2,
	32,2,32,32,32,32,32,2,32,2,32,2,2,32,2,32,2,5,32,32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_7	
	
	/*------------------------this is dividing line-------------------------*/
	
	printf("$---*-*-*-*-*-*-*-*-*-*-*---$\n\n");
	printf("欢迎！请输入你的名字(按q退出):\n");
	cin>>name;
	if(name=="ljy"){
		
		system("color 4");
		printf("******************************\n");
		printf("*                            *\n");
		printf("*                            *\n");
		printf("*                            *\n");
		printf("*             I              *\n");
		printf("*                            *\n");
		printf("*         Listen the         *\n");
		printf("*                            *\n");
		printf("*          Ocean's           *\n");
		printf("*                            *\n");
		printf("*           Voice            *\n");
		printf("*                            *\n");
		printf("*        Every minute        *\n");
		printf("*                            *\n");
		printf("*      Listen the ocean      *\n");
		printf("*                            *\n");
		printf("*      Just like listen      *\n");
		printf("*                            *\n");
		printf("*         Your heart         *\n");
		printf("*                            *\n");
		printf("*                            *\n");
		printf("*               ---by lv     *\n");
		printf("*                            *\n");
		printf("*                            *\n");
		printf("*                            *\n");
		printf("******************************\n");
		system("PAUSE");
		
		//return 0;//a painted eggshell___love is gone
		
	}

	/*------------------------this is dividing line-------------------------*/
	
	while(1){
		
	cin.sync();
	
	/*------------------------this is dividing line-------------------------*/
	
	printf("\n");
	printf("$  -*------------------*-  $\n");
	printf("|--$---*  %c  vs  %c  *---$--|\n",char(21),char(5));
	printf("$  -*--*--- Game ---*--*-  $\n");	
	printf("      -*------------*-     \n\n");	
	
	for(int i=0;i<15;i++){
		for(int j=0;j<26;j++){	
			printf("%c",a[i][j]);
		}
		printf("\n");
	}
	//original position of the map
	
	printf("\n");
	printf("$  --*----------------*--  $\n");
	printf("---$-* by anonymouslv *-$---\n",char(21),char(5));
	printf("$  --*----------------*--  $\n\n");
	printf("$***********************************$\n");
	printf("*                                   *\n");
	printf("* 游戏规则：                        *\n");		
	printf("* 使用w,a,s,d控制小人（左上角）移动 *\n");
	printf("* 吃到果子（自己找）即为游戏胜利    *\n");
	printf("* 按q键可以退出游戏                 *\n");
	printf("*                                   *\n");
	printf("$***********************************$\n\n");
	
	/*------------------------this is dividing line-------------------------*/
		
	ip=getch();
	
	switch(ip){
		case 's':
			if(a[x+1][y]!=0&&a[x+1][y]!=5){
				
				cout<<name<<" 别TM撞墙！！"<<endl;
				Sleep(500);
				system("cls");//clear 
				break;
				//system("color 2"); 
				//cout<<name<<"你死了，你没马!哈哈!!"<<endl;
				//system("PAUSE");
				//return 0;
			}
			else if(a[x+1][y]==5){
				cout<<name<<" 你赢啦，小伙子真不错！！\n"<<endl;
				Sleep(2000);
				cout<<"想关机吗\n"<<endl;
				Sleep(3000);
				cout<<"没关系只是吓吓你\n"<<endl;
				Sleep(2000);
				system("PAUSE");
				continue;
			} 
			else{
				//a[x][y]=0;//window_7
				a[x][y]=0;
				a[++x][y]=21;
				break;
			}//go back
		case 'd':
			if(a[x][y+1]!=0&&a[x][y+1]!=5){
				
				cout<<name<<" 别TM撞墙！！"<<endl;
				Sleep(500);
				system("cls");//clear 
				break;
				//system("color 2"); 
				//cout<<name<<"你死了，你没马!哈哈!!"<<endl;
				//system("PAUSE");
				//return 0;
			}
			else if(a[x][y+1]==5){
				cout<<name<<" 你赢啦，小伙子真不错！！\n"<<endl;
				Sleep(2000);
				cout<<"想关机吗\n"<<endl;
				Sleep(3000);
				cout<<"没关系只是吓吓你\n"<<endl;
				Sleep(2000);
				system("PAUSE");
				continue;	
			} 
			else{
				//a[x][y]=0;//window_7
				a[x][y]=0;
				a[x][++y]=21;
				break;
			}//turn right
		case 'w':
			if(a[x-1][y]!=0&&a[x-1][y]!=5){
				
				cout<<name<<" 别TM撞墙！！"<<endl;
				Sleep(500);
				system("cls");//clear 
				break;
				//system("color 2"); 
				//cout<<name<<"你死了，你没马!哈哈!!"<<endl;
				//system("PAUSE");
				//return 0;
			}
			else if(a[x-1][y]==5){
				cout<<name<<" 你赢啦，小伙子真不错！！\n"<<endl;
				Sleep(2000);
				cout<<"想关机吗\n"<<endl;
				Sleep(3000);
				cout<<"没关系只是吓吓你\n"<<endl;
				Sleep(2000);
				system("PAUSE");
				continue;
			}  
			else{
				//a[x][y]=0;//windows_7
				a[x][y]=0;
				a[--x][y]=21;
				break;
			}//go straight	
	
		case 'a':
			if(a[x][y-1]!=0&&a[x][y-1]!=5){
				
				cout<<name<<" 别TM撞墙！！"<<endl;
				Sleep(500);
				system("cls");//clear 
				break;
				//system("color 2"); 
				//cout<<name<<"你死了，你没马!哈哈!!"<<endl;
				//system("PAUSE");
				//return 0;
			}
			else if(a[x][y-1]==5){
				cout<<name<<" 你赢啦，小伙子真不错！！\n"<<endl;
				Sleep(2000);
				cout<<"想关机吗？？\n"<<endl;
				Sleep(3000);
				cout<<"要关了哦！！！\n"<<endl;
				Sleep(3000);
				cout<<"没关系只是吓吓你\n"<<endl;
				Sleep(2000);
				system("PAUSE");
				continue;	
			}
		 	else{
				//a[x][y]=0;//windows_7
				a[x][y]=0;
				a[x][--y]=21;
				break;
			}	//turn left
	
		case 'q': return 0;
	}
	
	/*------------------------this is dividing line-------------------------*/
		
		system("cls");//clear 
		
	}

	return 0;
}


//code by anonymouslv

